# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import csv


class CnBlogsPipeline(object):

    def process_item(self, item, spider):
        with open('test.csv', 'a', newline='')as f:
            f_csv = csv.writer(f)
            row = [item['curl'], item['num'], item['title'], item['content'], item['author'], item['time'],
                   item['digg'], item['comments'], item['read']]
            f_csv.writerow(row)
